package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/follow")
public class FollowController {

    @Autowired
    private IFollowService iFollowService;

    @PutMapping("/{id}/{isFollow}")
    public Result follow(@PathVariable("id") Long followUserId, @PathVariable("isFollow")Boolean isFollow){
        iFollowService.follow(followUserId, isFollow);
        return Result.ok();
    }

    @GetMapping("/or/not/{id}")
    public Result isFollow(@PathVariable("id") Long followUserId) {
        return Result.ok(iFollowService.isFollow(followUserId));
    }

    /** 根据用户id查询与当前用户共同关注的用户基本信息 */
    @GetMapping("/common/{id}")
    public Result followCommons(@PathVariable("id") Long userId){
        return Result.ok(iFollowService.followCommon(userId));
    }

}
